<%- include('../components/head.ejs'); %>
<body>
<style>
    .bd-placeholder-img {
        font-size: 1.125rem;
        text-anchor: middle;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    @media (min-width: 768px) {
        .bd-placeholder-img-lg {
            font-size: 3.5rem;
        }
    }
</style>
<div class="container">
    <div class="py-5 text-center">
        <h2>更新简历信息</h2>
        <p class="lead">在下面设置您的简历信息，别忘了点击"保存"按钮！</p>
    </div>

    <div class="row">
        <div class="col-md-12 order-md-1">
            <form class="needs-validation" novalidate>
                <h4 class="mb-3">网站信息</h4>
                <div class="row mb-4">
                    <div class="col-md-12 mb-3">
                        <label for="siteTitle">网站标题</label>
                        <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= siteTitle %>" required>
                    </div>
                </div>

                <h4 class="mb-3">个人信息</h4>
                <div class="row mb-4">
                    <div class="col-md-4 mb-3">
                        <label for="fullName">姓名</label>
                        <input type="text" class="form-control" id="fullName" placeholder="姓名" value="<%= name %>" required>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label for="country">性别</label>
                        <select class="custom-select d-block w-100" id="country" required>
                            <option value="">选择</option>
                            <option value="男" <%= gender === '男' ? "selected" : '' %>>男</option>
                            <option value="女" <%= gender === '女' ? "selected" : '' %>>女</option>
                        </select>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label for="position">职位</label>
                        <input type="text" class="form-control" id="position" placeholder="总经理" value="<%= position %>" required>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label for="phone">手机号</label>
                        <input type="text" class="form-control" id="phone" placeholder="手机号" value="<%= phone %>" required>
                    </div>
                    <div class="col-md-8 mb-3">
                        <label for="email">邮箱地址</label>
                        <input type="email" class="form-control" id="email" value="<%= email %>" placeholder="you@example.com">
                    </div>

                    <div class="col-md-12 mb-3">
                        <label for="address">居住地址</label>
                        <input type="text" class="form-control" id="address" value="<%= address %>" placeholder="李：浙江省杭州市西湖区" required>
                    </div>

                    <div class="col-md-12 mb-3">
                        <label for="weiboUrl">微博主页</label>
                        <input type="text" class="form-control" id="weiboUrl" placeholder="" value="<%= weiboUrl %>" required>
                    </div>
                    <div class="col-md-12 mb-3">
                        <label for="zhihuUrl">知乎主页</label>
                        <input type="text" class="form-control" id="zhihuUrl" placeholder="" value="<%= zhihuUrl %>" required>
                    </div>
                    <div class="col-md-12 mb-3">
                        <label for="blogUrl">博客主页</label>
                        <input type="text" class="form-control" id="blogUrl" placeholder="" value="<%= blogUrl %>" required>
                    </div>
                    <div class="col-md-12 mb-3">
                        <label for="introduce">自我介绍</label>
                        <textarea class="form-control" id="introduce" placeholder="" rows="3" required><%= introduce %></textarea>
                    </div>
                </div>

                <h4 class="mb-3">工作经历</h4>
                <div>
                    <% experience.forEach((item, idx) => { %>
                        <% if (idx > 0) { %>
                            <hr class="mb-4">
                        <% } %>
                        <div class="row mb-4">
                            <div class="col-md-6 mb-3">
                                <label for="siteTitle">岗位名称</label>
                                <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= item.title %>" required>
                            </div>
                            <div class="col-md-6 mb-3">
                                <label for="favicon">公司名称</label>
                                <input type="text" class="form-control" id="favicon" placeholder="https://www.example.com/favicon.ico" value="<%= item.byline %>" required>
                            </div>
                            <div class="col-md-12 mb-3">
                                <label for="siteTitle">起始时间</label>
                                <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= item.duration %>" required>
                            </div>
                            <div class="col-md-12 mb-3">
                                <label for="siteTitle">工作描述</label>
                                <textarea rows="6" class="form-control" id="siteTitle" placeholder="XX的个人主页" required><%= item.descriptions.join('\n') %></textarea>
                            </div>
                        </div>
                    <% }) %>
                </div>


                <h4 class="mb-3">教育经历</h4>
                <div>
                    <% education.forEach((item, idx) => { %>
                        <% if (idx > 0) { %>
                            <hr class="mb-4">
                        <% } %>
                        <div class="row <%= idx < education.length - 1 ? '' : 'mb-4' %>">
                            <div class="col-md-6 mb-3">
                                <label for="siteTitle">学校名称</label>
                                <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= item.title %>" required>
                            </div>
                            <div class="col-md-6 mb-3">
                                <label for="favicon">学位</label>
                                <input type="text" class="form-control" id="favicon" placeholder="https://www.example.com/favicon.ico" value="<%= item.byline %>" required>
                            </div>
                            <div class="col-md-6 mb-3">
                                <label for="siteTitle">专业名称</label>
                                <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= item.major %>" required>
                            </div>
                            <div class="col-md-6 mb-3">
                                <label for="siteTitle">起始时间</label>
                                <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= item.duration %>" required>
                            </div>
                            <div class="col-md-12 mb-3">
                                <label for="siteTitle">学习描述</label>
                                <textarea rows="6" class="form-control" id="siteTitle" placeholder="XX的个人主页" required><%= item.descriptions.join('\n') %></textarea>
                            </div>
                        </div>
                    <% }) %>
                </div>

                <h4 class="mb-3">技能描述</h4>
                <div>
                    <% skills.forEach((item, idx) => { %>
                        <% if (idx > 0) { %>
                            <hr class="mb-4">
                        <% } %>
                        <div class="row <%= idx < skills.length - 1 ? '' : 'mb-4' %>">
                            <div class="col-md-6 mb-3">
                                <label for="siteTitle">技能大类</label>
                                <input type="text" class="form-control" id="siteTitle" placeholder="XX的个人主页" value="<%= item.title %>" required>
                            </div>
                            <div class="col-md-12 mb-3">
                                <label for="siteTitle">技能描述</label>
                                <textarea rows="6" class="form-control" id="siteTitle" placeholder="XX的个人主页" required><%= item.descriptions.join('\n') %></textarea>
                            </div>
                        </div>
                    <% }) %>
                </div>

                <h4 class="mb-3">兴趣爱好</h4>
                <div class="row mb-4">
                    <div class="col-md-12 mb-3">
                        <label for="siteTitle">具体描述</label>
                        <textarea rows="6" class="form-control" id="siteTitle" placeholder="XX的个人主页" required><%= interests.join('\n') %></textarea>
                    </div>
                </div>

                <h4 class="mb-3">荣誉证书</h4>
                <div class="row mb-4">
                    <div class="col-md-12 mb-3">
                        <label for="siteTitle">具体描述</label>
                        <textarea rows="6" class="form-control" id="siteTitle" placeholder="XX的个人主页" required><%= awards.join('\n') %></textarea>
                    </div>
                </div>

                <hr class="mb-4">
                <div class="row">
                    <div class="col-md-3">
                        <button id="save" class="btn btn-primary btn-lg btn-block" type="submit">保存修改</button>
                    </div>
                    <div class="col-md-3">
                        <button id="see" class="btn btn-primary btn-lg btn-block" type="submit">查看简历</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <footer class="my-5 pt-5 text-muted text-center text-small">
        <p class="mb-1">&copy; <%= currentYear %> <%= siteTitle %></p>
    </footer>
</div>

<script src="/jquery/3.5.1/jquery.min.js"></script>
<script src="/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js"></script>

<script>
    $('#see').click(function (e) {
        e.preventDefault();
        location.href = '/';
    })
    $('#save').click(function (e) {
        e.preventDefault();
        location.reload();
    });
</script>

</body>
<%- include('../components/foot.ejs'); %>
